"use strict";

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = (app) => {
  const { router, controller, jwt } = app;
  router.post("/login", controller.admin.login);
  router.post("/register", controller.admin.register);
  router.get("/product/list", jwt, controller.product.list);
  router.post("/product/add", jwt, controller.product.add);
  router.put("/product/:id", jwt, controller.product.update);
  router.get("/product/:id", jwt, controller.product.detail);
  router.delete("/product/:id", jwt, controller.product.delete);
  router.post("/file", jwt, controller.file.upload);
  router.get("/file", jwt, controller.file.list);

  router.get("/", controller.home.index);
  router.resources("users", "/users", controller.user);

  // router.post('/api/post',controller.home.create)
};
